import java.util.Scanner;

public class Test {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while(scanner.hasNext()){
            int a = scanner.nextInt();
            int b = scanner.nextInt();
            int d = 1;
            while(d!=0) {
                int c = a / b;//辗转相除法
                d = a % b;
                a = b;
                b = d;
            }
            System.out.println(a);
        }
    }
}
